package com.hangar.eforms.service;

import com.hangar.eforms.entity.FormsDataChangeEntity;
import com.hangar.eforms.mapper.FormsDataChangeMapper;
import com.hangar.eforms.vo.FormsDataChangeVo;
import jakarta.annotation.Resource;
import java.util.List;
import org.springframework.stereotype.Service;

@Service
public class FormsDataChangeService {

    @Resource
    private FormsDataChangeMapper formsDataChangeMapper;


    public int deleteById(Integer id) {
        return formsDataChangeMapper.deleteById(id);
    }


    public int insert(FormsDataChangeEntity record) {
        return formsDataChangeMapper.insert(record);
    }


    public FormsDataChangeEntity loadById(Integer id) {
        return formsDataChangeMapper.loadById(id);
    }

    /**
     * 根据表单数据ID查询表单所有杠改记录
     * @param formDataId 表单数据ID
     * @return 按杠改时间倒序返回查询结果
     */
    public List<FormsDataChangeVo> allByFormDataId(Integer formDataId) {
        return formsDataChangeMapper.allByFormDataId(formDataId);
    }

    /**
     * 批量插入表单杠改数据
     * @param changeList 杠改数据
     */
    public void batchInsert(List<FormsDataChangeEntity> changeList) {
        formsDataChangeMapper.batchInsert(changeList);
    }

    public int update(FormsDataChangeEntity record) {
        return formsDataChangeMapper.update(record);
    }

}
